home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / bfd / cf-i386lynx.c < prev    next >
C/C++ Source or Header  |  1994-09-11  |  2KB  |  67 lines

  1. /* BFD back-end for Intel 386 COFF LynxOS files.
  2.    Copyright 1993, 1994 Free Software Foundation, Inc.
  3.    Written by Cygnus Support.
  4.  
  5. This file is part of BFD, the Binary File Descriptor library.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #include "bfd.h"
  22. #include "sysdep.h"
  23.  
  24. #define TARGET_SYM    i386lynx_coff_vec
  25. #define TARGET_NAME    "coff-i386-lynx"
  26.  
  27. #define LYNXOS
  28.  
  29. #define COFF_LONG_FILENAMES
  30.  
  31. #define coff_bfd_link_add_symbols lynx_link_add_symbols
  32.  
  33. static boolean lynx_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *));
  34.  
  35. #include "coff-i386.c"
  36.  
  37. /* On Lynx, we may have a COFF archive which contains a.out elements.
  38.    This screws up the COFF linker, which expects that any archive it
  39.    gets contains COFF elements.  We override the add_symbols function
  40.    to check for this case.  */
  41.  
  42. static boolean
  43. lynx_link_add_symbols (abfd, info)
  44.      bfd *abfd;
  45.      struct bfd_link_info *info;
  46. {
  47.   if (bfd_get_format (abfd) == bfd_archive)
  48.     {
  49.       bfd *first;
  50.  
  51.       first = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
  52.       if (first == NULL)
  53.     return false;
  54.       if (! bfd_check_format (first, bfd_object))
  55.     return false;
  56.       if (bfd_get_flavour (first) != bfd_target_coff_flavour)
  57.     {
  58.       /* Treat the archive as though it were actually of the
  59.          flavour of its first element.  This ought to work,
  60.          since the archive support is fairly generic.  */
  61.       return (*first->xvec->_bfd_link_add_symbols) (abfd, info);
  62.     }
  63.     }
  64.  
  65.   return _bfd_coff_link_add_symbols (abfd, info);
  66. }
  67.